package com.doge.calcalbum.core.base

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.doge.calcalbum.utils.isMainThread

private val e = MutableLiveData<Pair<String, Any?>?>()
val events: LiveData<Pair<String, Any?>?> = e
fun postEvent(action: String?, extra: Any?) {
    if (action == null) return
    require(isMainThread())
    e.value = Pair(action, extra)
    e.value = null
}

object Event {
    const val SWITCH_MAIN_TAB = "switchMainTab"
    const val PUSH_INTENT = "pushIntent"
}